package com.atguigu.eduService.controller.front;

import com.atguigu.common.Result;
import com.atguigu.eduService.entity.EduCourse;
import com.atguigu.eduService.entity.EduTeacher;
import com.atguigu.eduService.service.EduCourseService;
import com.atguigu.eduService.service.EduTeacherService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Summerday
 */

@RestController
@RequestMapping("/eduService/indexFront")
//@CrossOrigin
public class IndexFrontController {

    @Autowired
    private EduCourseService courseService;

    @Autowired
    private EduTeacherService teacherService;

    @GetMapping("index")
    public Result index(){
        List<EduCourse> courseList = courseService.listCourse();
        List<EduTeacher> teacherList = teacherService.listTeacher();
        return Result.ok().data("courses",courseList).data("teachers",teacherList);
    }

}
